/*
 * Copyright (C) 2004, Velocityme Partnership
 * SearchDateActionForm.java
 *
 * Created on 02 October 2004, 06:39
 */

package com.velocityme.www.actionforms;

import java.util.Calendar;
import org.apache.struts.action.*;

/**
 *
 * @author  Robert
 */
public class SearchDateActionForm extends ActionForm {
    
    private int m_nodeId;
    private int m_startYear;
    private int m_startMonth;
    private int m_startDay;
    private int m_stopYear;
    private int m_stopMonth;
    private int m_stopDay;
    
    /** Creates a new instance of SearchDateActionForm */
    public SearchDateActionForm() {
    }
    
    public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) {
        m_startYear = 0;
        m_startMonth = 0;
        m_startDay = 0;
        m_stopYear = 0;
        m_stopMonth = 0;
        m_stopDay = 0;
    }
    
    public int getNodeId() {
        return m_nodeId;
    }
    
    public void setNodeId(int nodeId) {
        m_nodeId = nodeId;
    }
    
    public int getStartYear() { return m_startYear; }   
    public void setStartYear(int year) { m_startYear = year; }    
    public int getStartMonth() { return m_startMonth; }    
    public void setStartMonth(int month) { m_startMonth = month; }    
    public int getStartDay() { return m_startDay; }    
    public void setStartDay(int day) { m_startDay = day; }
    public void setStartDate(Calendar calendar) {
        setStartYear(calendar.get(Calendar.YEAR));
        setStartMonth(calendar.get(Calendar.MONTH));
        setStartDay(calendar.get(Calendar.DATE));
    }
    public Calendar getStartDate() {
        Calendar date = Calendar.getInstance();
        date.set(getStartYear(), getStartMonth(), getStartDay(), 0, 0, 0);
        return date;
    }
    
    public int getStopYear() { return m_stopYear; }   
    public void setStopYear(int year) { m_stopYear = year; }    
    public int getStopMonth() { return m_stopMonth; }    
    public void setStopMonth(int month) { m_stopMonth = month; }    
    public int getStopDay() { return m_stopDay; }    
    public void setStopDay(int day) { m_stopDay = day; }
    public void setStopDate(Calendar calendar) {
        setStopYear(calendar.get(Calendar.YEAR));
        setStopMonth(calendar.get(Calendar.MONTH));
        setStopDay(calendar.get(Calendar.DATE));
    }
    public Calendar getStopDate() {
        Calendar date = Calendar.getInstance();
        date.set(getStopYear(), getStopMonth(), getStopDay(), 23, 59, 59);
        return date;
    }
    
    
}
